package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;
//Exception:编译时异常  代码编译时必须处理
@Data
public class StgyException extends RuntimeException{
    private Integer code;
    private String message;
    //接收真实异常对象
    private Throwable throwable;
    public StgyException(Integer code, String message){
        this(code,message,null);
    }
    public StgyException(Integer code, String message,Throwable throwable){
        this.code = code;
        this.message = message;
        this.throwable = throwable;
    }
    public StgyException(ResultCodeEnum codeEnum){
        this(codeEnum.getCode(),codeEnum.getMessage());
    }
    public StgyException(ResultCodeEnum codeEnum,Throwable throwable){
        this(codeEnum.getCode(),codeEnum.getMessage(),throwable);
    }
}
